/**
 *  @(#)  IFAAAuthenticator  module    1.0  2017/03/24
 *
 *  Copyright  (c)  2017,  IFAA  and/or  its  affiliates.  All  rights  reserved.
 *
 *  Redistribution  and  use  in  source  and  binary  forms,  with  or  without
 *  modification,  are  permitted  provided  that  the  following  conditions  are  met:
 *
 *  -Redistribution  of  source  code  must  retain  the  above  copyright  notice,  this
 *    list  of  conditions  and  the  following  disclaimer.
 *
 *  -Redistribution  in  binary  form  must  reproduce  the  above  copyright  notice,
 *    this  list  of  conditions  and  the  following  disclaimer  in  the  documentation
 *    and/or  other  materials  provided  with  the  distribution.
 *
 *  Neither  the  name  of  IFAA  or  the  names  of  contributors  may
 *  be  used  to  endorse  or  promote  products  derived  from  this  software  without
 *  specific  prior  written  permission.
 *
 *  This  software  is  provided  "AS  IS,"  without  a  warranty  of  any  kind.  ALL
 *  EXPRESS  OR  IMPLIED  CONDITIONS,  REPRESENTATIONS  AND  WARRANTIES,  INCLUDING
 *  ANY  IMPLIED  WARRANTY  OF  MERCHANTABILITY,  FITNESS  FOR  A  PARTICULAR  PURPOSE
 *  OR  NON-INFRINGEMENT,  ARE  HEREBY  EXCLUDED.  IFAA,  ORG.
 *  AND  ITS  LICENSORS  SHALL  NOT  BE  LIABLE  FOR  ANY  DAMAGES  SUFFERED  BY  LICENSEE
 *  AS  A  RESULT  OF  USING,  MODIFYING  OR  DISTRIBUTING  THIS  SOFTWARE  OR  ITS
 *  DERIVATIVES.  IN  NO  EVENT  WILL  IFAA  OR  ITS  LICENSORS  BE  LIABLE  FOR  ANY  LOST
 *  REVENUE,  PROFIT  OR  DATA,  OR  FOR  DIRECT,  INDIRECT,  SPECIAL,  CONSEQUENTIAL,
 *  INCIDENTAL  OR  PUNITIVE  DAMAGES,  HOWEVER  CAUSED  AND  REGARDLESS  OF  THE  THEORY
 *  OF  LIABILITY,  ARISING  OUT  OF  THE  USE  OF  OR  INABILITY  TO  USE  THIS  SOFTWARE,
 *  EVEN  IF  IFAA  HAS  BEEN  ADVISED  OF  THE  POSSIBILITY  OF  SUCH  DAMAGES.
 *
 *  You  acknowledge  that  this  software  is  not  designed,  licensed  or  intended
 *  for  use  in  the  design,  construction,  operation  or  maintenance  of  any
 *  nuclear  facility.
 *
 */
package com.ifaa.sdk.auth;

import android.content.Context;

import com.ifaa.sdk.auth.message.AuthenticatorMessage;

/**
 * 
 * @author junsui.ljs
 * @version $Id: IFingerPrint.java, v 0.1 2014 4:32:10 junsui.ljs Exp $
 */
public interface IAuthenticator {


    /**
     * 认证对象在该设备是否支持
     * @return
     */
    public boolean isSupported();
    /**
     * IFAA服务端指令处理接口，如注册，校验和注销等功能
     * 
     * @param request 服务端下发的指令对象
     * @param authenticatorCallback 校验过程的回调类，相关的状态信息都会回调该类的接口
     */
    public void process(AuthenticatorMessage request, AuthenticatorCallback authenticatorCallback);

    /**
     * synchronous process requestMessage
     * @param request
     * @return AuthenticatorResponse
     */
    public String process(AuthenticatorMessage request);

    /**
     * 取消认证过程
     */
    public void cancel();

    /**
     * 取消认证过程
     * 
     * @param context
     */
    public void cancel(Context context);

    /**
     * release the api
     */
    public void release();

    /**
     * 获取设备id
     * 
     * @return 返回设备id
     */
    public String getDeviceId();

    /**
     * get Auth info
     * 
     * @return
     */
    public AuthInfo getAuthInfo();

    /**
     * prapareKeyPair 
     *
     * @return
     */
    public void prapareKeyPair();

    /**
     * 检查用户的开通状态
     * @param token 用户对应的token
     * @return 0表示没有开通，2表示开通了，1表示开通了但是本地的认证模板删除了,见定义AuthenticatorConstants.CLIENT_STATUS_xxx
     */
    public int checkUserStatus(String token);


    /**
     * 是否录入了认证的模板，如录入指纹模板
     * @return false表示系统中还未录入模板
     */
    public boolean hasEnrolled();

    /**
     * 开启系统的认证录入界面
     */
    public void startSystemEnrollManger();
}
